
<style>
.level1 {color:red;font-weight:bold;}
.level2 {color:blue;font-weight:bold;}
</style>

<div class="container clearfix">
    {{$this->Html->link(__('上级分类'),array('action'=>'toplist',$cid))}}
    
  <ul class="nav nav-tabs">
      <li><a href="#search-by-condition" data-toggle="tab"><span>按关键字/类别</span></a></li>
      <li><a href="#search-by-num_iid" data-toggle="tab"><span>按淘宝id</span></a></li>
  </ul>
  <div class="tab-content">
         <div  id="search-by-condition" class="tab-pane active clearfix">
             <form method="get" data-noajax="noajax" action="{{Router::url('/admin/taobao/taobaokes/products/'.$cid.'/')}}">

          <div>
                关键字：     <input type="text" name="keyword" value="{{$_GET['keyword']}}" >
                <br/>
                开始价格： <input type="text" name="start_price" value="{{$_GET['start_price']}}" >
                最大价格： <input type="text" name="end_price" value="{{$_GET['end_price']}}" >
                <br/>
                起始佣金比率： <input type="text" name="start_commissionRate" value="{{$_GET['start_commissionRate']}}" > (如：1234表示12.34% )

                起始推广量： <input type="text" name="start_commissionNum" value="{{$_GET['start_commissionNum']}}" > (30天内累计推广量,必需大于3，有人购买过，确保范围合理)

          </div>
          排序方式：
        <select id="sorttype" name="sort">
        <option value="price_desc">价格从高到低</option>	<option value="price_asc">价格从低到高</option>
        <option value="credit_desc">信用等级从高到低</option>
        <option value="commissionRate_desc">佣金比率从高到低</option><option value="commissionRate_asc">佣金比率从低到高</option>
        <option value="commissionNum_desc" selected="selected">成交量成高到低</option><option value="commissionNum_asc">成交量从低到高</option>
        <option value="commissionVolume_desc">总支出佣金从高到低</option><option value="commissionVolume_asc">总支出佣金从低到高</option>
        <option value="delistTime_desc">商品下架时间从高到低</option><option value="delistTime_asc">商品下架时间从低到高</option>
        </select>

         <div><input type="checkbox" id="mall_item" name="mall_item" value="true" {{if $_GET['mall_item']}}checked="true"{{/if}} /> <label for="mall_item">是否淘宝商城（天猫）</label> </div>
<div style="clear:both;"></div>
         <div><input type="submit"  value="搜索" /> </div>
          </form>
         </div>
        <div  id="search-by-num_iid" class="tab-pane">
             <form method="get" action="{{Router::url('/admin/taobao/taobaokes/updateTaobaoke/')}}">

         商品编号：     <input type="text" name="num_iid" value="{{$_GET['num_iid']}}" >

         <div><input type="submit"  value="搜索" /> </div>
          </form>
         </div>
 </div>
</div>
  

  
<script>
{{if $_GET['sort']}}
$('#sorttype').val('{{$_GET['sort']}}');
{{/if}}


rs_callbacks.saveTaobaoke = function(request,obj){
			obj.href='javascript:void(0);';
			$(obj).removeAttr('onclick');
			$(obj).click(function(){return false;});
			$(obj).html('已加入');
}
</script>

	<div>{{$page_navi}}</div>
	<div class="container clearfix">
		{{loop $products $key $product}}
			<div class="ui-float-left" style="margin:5px;">

                            {{$this->Html->link($this->Html->image($product['pic_url'],array('width'=>180,'title'=>$product['title'],'height'=>180,'action'=>'products',$cat['cid'])),
                            $product['click_url'],array('escape'=>false,'target'=>'_blank')
                            )}}
				
				<br/>  
				
				{{if $product['commission_rate']>2000}}
				<p class="level1">佣金：{{$product['commission']}}&nbsp; 月推广：{{$product['commission_num']}} </p>
				<p class="level1">价格：{{$product['price']}}({{round($product['commission_rate']/100,2)}}%)</p>
				{{elseif  $product['commission_rate']>1000}}
				<p class="level2">佣金：{{$product['commission']}}&nbsp; 月推广：{{$product['commission_num']}} </p>
				<p class="level2">价格：{{$product['price']}}({{round($product['commission_rate']/100,2)}}%)</p>
				{{else}}
				<p>佣金：{{$product['commission']}}&nbsp; 月推广：{{$product['commission_num']}} </p>
				<p>价格：{{$product['price']}}({{round($product['commission_rate']/100,2)}}%)</p>				
				{{/if}}
				
				{{if !in_array($product['num_iid'],$exists_num_iids)}}				
					{{$this->Html->link('加入商品库',array('action'=>'updateTaobaoke',$product['num_iid'],),array('onclick'=>"return ajaxAction(this.href,'',null,'saveTaobaoke',this);"))}}
				{{else}}
				已加入
				{{/if}}
			</div>
		{{/loop}}
	</div>
	<div>{{$page_navi}}</div>
<div style="clear:both;"></div>